<template>
  <div>
    <van-nav-bar
      title="收藏页"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <div>
      <van-card
        v-for="item in movieAll"
        :key="item.id"
        :desc="item.Introduction"
        :title="item.name"
        :thumb="item.posters"
      >
        <template #bottom>
          类型：<van-tag type="warning">{{ item.category }}</van-tag>
        </template>
        <template #footer>
          <van-button
            round
            type="info"
            size="small"
            color="linear-gradient(to right, #9b9483, #77664e)"
            @click="toDetails(item.id)"
            >购买</van-button
          >
        </template>
      </van-card>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      movieAll: [],
    };
  },
  created() {
    this.getMovieAll();
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
    async getMovieAll() {
      const { data: res } = await this.$http.get("storeup");
      console.log(res);
      if (res.status !== 200) return this.$message.fail("获取电影失败");
      this.movieAll = res.data;
    },
    toDetails(id) {
      this.$router.push({
        path: `/details/${id}`,
      });
    },
  },
};
</script>

<style>
</style>